package ChatSystem;

import java.io.File;

public interface LocalUser {
	/**
	 * Update the users table's content, when for example a user joins or leaves, or when a unread counter is updated.
	 */
	public abstract void updateUserList();
	
	/**
	 * Update the current conversation being displayed, when another user is selected or a message is sent or received.
	 */
	public abstract void updateMessageList();
	
	
	/**
	 * Switches the current view to "Login".
	 */
	public abstract void displayLogin();
	
	/**
	 * Switches the current view to "Chat".
	 */
	public abstract void displayChat();

	/**
	 * Presents a file request to the user, and asks whether the file should be kept or discarded.
	 * @param user The sender of the file.
	 * @param filename The name of the file to be received.
	 */
	public abstract void presentFileRequest(User user, String filename);

	/**
	 * Displays a dialog to the user with an error description.
	 * @param error A description of which error occurred
	 */
	public abstract void presentError(String error);

	/**
	 * Forwards the message to send to the ChatController.
	 * @param user The recipient of the message
	 * @param message The body of the message
	 */
	public abstract void onSendMessage(User user, String message);

	/**
	 * Forwards the file to send to the ChatController.
	 * @param user The recipient of the file
	 * @param file The file to send
	 */
	public abstract void onSendFile(User user, File file);
	
	
	/**
	 * Performs the login operation.
	 * @param nickname The nickname we will be known to other users by
	 */
	public abstract void onLogin(String nickname);

	/**
	 * Performs a logout operation and then switch to the "Login" view.
	 */
	public abstract void onLogout();
	
	/**
	 * Fired when the user has selected another user from what was selected before.
	 */
	public abstract void onSelectedUserChange();

	/**
	 * Notifies the controller that we wish to accept the file request.
	 * @param user The sender of the file
	 * @param filename The name of the file to be received
	 * @param saveFile The path where we want the file to be saved
	 */
	public abstract void onAcceptFileRequest(User user, String filename, File saveFile);

	/**
	 * Notifies the controller that we wish not to accept the file request.
	 * @param user The sender of the file
	 * @param filename The name of the declined file
	 */
	public abstract void onDeclineFileRequest(User user, String filename);
}
